package com.smh.demo1.a05;

import org.springframework.context.support.GenericApplicationContext;

import java.io.IOException;

/**
 * @author shiminghui
 * @date 2025/4/11 16:41
 * @description: TODO
 */
public class A05Application {

    public static void main(String[] args) throws IOException, ClassNotFoundException {

        GenericApplicationContext context = new GenericApplicationContext();
        context.registerBean("config", Config.class);

//        context.addBeanFactoryPostProcessor(new ConfigurationClassPostProcessor()); // 解析@Configuration,@ComponentScan 和 @Bean注解
//        MapperScannerConfigurer mapperScannerConfigurer = new MapperScannerConfigurer();
//        mapperScannerConfigurer.setBasePackage("com.smh.demo1.a05.mapper");
//        context.addBeanFactoryPostProcessor(mapperScannerConfigurer); // 解析@MapperScan注解
        context.addBeanFactoryPostProcessor(new MyConfigurationClassPostProcessor());
        context.addBeanFactoryPostProcessor(new MyMapperScanPostProcessor());


        System.out.println("==========================================");


        context.refresh();

        System.out.println("==========================================");
        for (String beanName : context.getBeanDefinitionNames()) {
            System.out.println(beanName);
        }

    }

}
